﻿<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="Content-Style-Type" content="text/css" /><meta name="generator" content="Aspose.Words for .NET 15.1.0.0" /><title></title></head><body><div><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:center; text-indent:0pt; widows:0"><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">第</span><span style="font-family:Consolas; font-size:22pt; font-weight:bold">11</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">章</span><span style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">推送系统的实现</span></h1><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">1</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">推送系统的简介</span></h1><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">向前台系统推送市场详情数据</span><span style="font-family:Consolas; font-size:10.5pt">\K-Line</span><span style="font-family:微软雅黑; font-size:10.5pt">数据</span><span style="font-family:Consolas; font-size:10.5pt">\</span><span style="font-family:微软雅黑; font-size:10.5pt">深度数据</span><span style="font-family:Consolas; font-size:10.5pt">\</span><span style="font-family:微软雅黑; font-size:10.5pt">盘口数据等等</span><span style="font-family:Consolas; font-size:10.5pt">!</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><a href="https://www.aofex.co/#/"><span style="color:#0000ff; font-family:Consolas; font-size:10.5pt; text-decoration:none">https://www.aofex.co/#/</span></a></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">参考这个网站</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">  </span><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.001.png" width="554" height="110" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.002.png" width="554" height="233" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.003.png" width="554" height="276" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.004.png" width="260" height="553" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.005.png" width="255" height="553" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">2</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">前端实现</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">2.1 WebSocket</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">工具类</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">位于</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.006.png" width="526" height="67" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">function SocketHandler(url) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">基于</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">H5</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">原生</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">api</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  this.ws = new WebSocket(url);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">定义一个信号发射塔，用于发送事件</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">  </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">this.tower = document.createElement('div');</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">}</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">SocketHandler.prototype = {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">订阅频道</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">  </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">channels : {},</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">反应堆（用于收集和分发</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">socket</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">的响应）</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">  </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">reactions : {},</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">缓存监听事件</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">  </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">events : [],</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">获取当前时间</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">  </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">nowTime : function() {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    return new Date().getTime();</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  },</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">打开</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">socket</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">连接</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">  </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">open : function(heartbeatTimeout) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    this.ws.onopen = function(){</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      var heartbeatSendInterval = heartbeatTimeout / 2;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      this.lastSubscribeTime = this.nowTime();</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      this.pingIntervalId = setInterval(function(){</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        var iv = this.nowTime() - this.lastSubscribeTime;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">超过一定时间自动与后台</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">ping</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">、</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">pong  </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">单位：秒</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">        </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">if ((heartbeatSendInterval + iv) &gt;= heartbeatTimeout) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          this.send('ping');</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      }.bind(this), heartbeatSendInterval);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    }.bind(this);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  },</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">创建自定义事件</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">  </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">createEvent : function(event, detail){</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    var evt = document.createEvent('CustomEvent');</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    evt.initCustomEvent(event, false, false, detail);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    return evt;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  },</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">打开</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">socket</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">连接</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">  </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">connect: function(heartbeatTimeout) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    this.open(heartbeatTimeout);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    this.message();</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    this.close();</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  },</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">订阅消息 </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">ch </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">为订阅的频道 </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">id </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">为订阅唯一标识</span></p><p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">  </span><span style="color:#0000ff; font-family:Consolas; font-size:11pt; font-weight:bold; vertical-align:baseline">subscribe </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">: function(ch, id, token) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    if(this.ws.readyState == 1) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      var obj = {};</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      if(ch) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        obj.sub = ch;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        obj.id = id;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        if(token) obj.authorization = token;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        if(this.channels.hasOwnProperty(id)) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          this.unsubscribe.apply(this, Object.values(this.channels[id]));</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        this.channels[id] = obj;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        this.reactions[ch] = this.createEvent(id);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        this.send(obj);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  },</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">监听订阅结果</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">  </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">on : function(id, callback) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    var handler = function(e) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      if(callback) callback(e.data, e);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    };</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    this.tower.addEventListener(id, handler);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    var key = id + '_' + this.nowTime();</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    this.events.push({key : key, handler: handler});</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  },</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">取消订阅</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">  </span><span style="color:#0000ff; font-family:Consolas; font-size:10.5pt; font-weight:bold; vertical-align:baseline">unsubscribe </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">: function(ch, id, token) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    if(this.ws.readyState == 1) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      var obj = {};</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      if(ch) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        obj.cancel = ch;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        obj.id = id;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        if(token) obj.authorization = token;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        if(this.channels.hasOwnProperty(id)) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          delete this.channels[id];</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          delete this.reactions[ch];</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        this.events = this.events.filter(function(v){</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          if(v.key.indexOf(id) !== -1) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            // </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">失效</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">ID</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">解除监听</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">            </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">this.tower.removeEventListener(id, v.handler);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          }else{</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            return v;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        }.bind(this));</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        this.send(obj);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  },</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  send : function(data){</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    if(typeof data === 'object') {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      data = JSON.stringify(data);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    this.ws.send(data);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  },</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  message : function() {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    this.ws.onmessage = function(evt){</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      var data = evt.data;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      this.lastSubscribeTime = this.nowTime();</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      if(data) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        if(data !== 'pong') data = JSON.parse(data);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        if(typeof data === 'object' &amp;&amp; data.hasOwnProperty('ch')) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          var e = this.reactions[data.ch];</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          if(e) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            e.data = data;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            this.tower.dispatchEvent(e);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    }.bind(this);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  },</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  close : function(callback) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    this.ws.onclose = function(evt){</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      clearInterval(this.pingIntervalId);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      if(callback) callback(evt, this.ws);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    }.bind(this);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">};</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">2.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">深度数据的订阅</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">      </span><span style="font-family:Consolas; font-size:10.5pt">subscribeDepths(kline) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">        let symbol = this.currentMarket.symbol.toLowerCase();</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">        let mergeDepth = this.chooseMergeDepth;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">        this.$socket.subscribe(`market.${symbol}.depth.${mergeDepth}`, 'market-depth');</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">        this.$socket.on('market-depth', (data) =&gt; {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">          this.depthsData = data.tick;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">          if(kline &amp;&amp; kline.contentWindow) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">            kline.contentWindow.set_current_depth(this.depthsData);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">          }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">          this.processDepthData()</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">        })</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">      },</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">2.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">成交记录的订阅</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">      </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">subscribeTrades() {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        let symbol = this.currentMarket.symbol.toLowerCase();</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        this.$socket.subscribe(`market.${symbol}.trade.detail`, 'market-trade');</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        this.$socket.on('market-trade', (data) =&gt; {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          // console.log("</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">成交记录</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">",data)</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          this.tradesData = data.data;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        })</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      },</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">2.4 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">历史委任数据的订阅</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">      </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">//</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">订阅历史委托</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">      </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">subscribeTurnover() {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        this.$socket.subscribe(`order.finished.update`, 'order-finished', this.token);</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        this.$socket.on('order-finished', (data) =&gt; {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          // console.log("</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">成交记录事件</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">", data)</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          this._serverGetTurnoverOrderList()</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        })</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      }</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">2.5 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">市场对的订阅</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">      </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">/**</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">       * </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">订阅全部的市场对</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">       </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">*/</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      subscribeAllMarkets() {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        this.$socket.subscribe("market.ticker", 'all-market-area');</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        this.$socket.on('all-market-area', (data) =&gt; {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          // console.log("</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">全部市场订阅</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">", data)</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          if (data.markets) {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            let filteredFavorites = data.markets.filter((item) =&gt; {</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">              let itemSymbol = item.symbol.toLowerCase();</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">              return this.userFavorites.indexOf(itemSymbol) !== -1;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            })</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            // console.log("</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">过滤后的</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">", filteredFavorites)</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            let len = this.marketList.length;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            this.marketList[len - 1].markets = filteredFavorites;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">          }</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        });</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">      },</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">....</span></p><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">3</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">接入</span><span style="font-family:Consolas; font-size:22pt; font-weight:bold">Tio</span></h1><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">https://www.tiocloud.com/2/product/tio.html</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.007.png" width="553" height="222" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">3.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">添加</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">tio </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">依赖</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">在</span><span style="font-family:Consolas; font-size:10.5pt">coin-exchange</span><span style="font-family:微软雅黑; font-size:10.5pt">的</span><span style="font-family:Consolas; font-size:10.5pt">pom.xml </span><span style="font-family:微软雅黑; font-size:10.5pt">文件里面添加版本控制</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:12pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:12pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:12pt">tio.version</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:12pt">&gt;3.5.5.v20191010-RELEASE&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:12pt">tio.version</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:12pt">&gt;</span></p></td></tr><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">dependencyManagement</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">  &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">dependencies</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span></p><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">     ...</span></p><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:21pt"><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">  </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;org.t-io&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">  </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;tio-websocket-spring-boot-starter&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">  </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">version</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;${tio.version}&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">version</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span></p><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:21pt"><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">...</span></p><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:10.5pt"><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">dependencies</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">dependencyManagement</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span></p><p style="background-color:#ffffff; font-size:12pt; line-height:115%; margin:0pt 0pt 10pt"><span style="color:#080808; font-family:Consolas; font-size:12pt">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">修改</span><span style="font-family:Consolas; font-size:10.5pt">chan-service</span><span style="font-family:微软雅黑; font-size:10.5pt">的</span><span style="font-family:Consolas; font-size:10.5pt">pom.xml</span><span style="font-family:微软雅黑; font-size:10.5pt">文件</span><span style="font-family:Consolas; font-size:10.5pt">,</span><span style="font-family:微软雅黑; font-size:10.5pt">添加以下依赖</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">    &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;org.t-io&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">    &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;tio-websocket-spring-boot-starter&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">添加日期的工具类</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">    &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;joda-time&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">    &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;joda-time&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:11pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:11pt">&gt;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">3.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">添加配置文件</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">3.2.1 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">本地 </span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">bootstrap.yml</span></h3><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">spring</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">application</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">name</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: chan-service</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">cloud</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># nacos</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">地址</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">nacos</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">server-addr</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: nacos-server:8848</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">config</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">file-extension</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: yaml</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">profiles</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">active</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: dev</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">拉取的配置文件的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">dataID =  chan-service-dev.yaml</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># tio</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">的配置文件</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">websocket</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">server</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">port</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">8987  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">监听的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">websocket</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">端口</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">heartbeat-timeout</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">600000  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">心跳时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">cluster</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">开启集群</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">enabled</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">true</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">      redis</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">#  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">集群基于</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">Redis Pus/Sub</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">ip</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: redis-server</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">port</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">6380</span><br /><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">password</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:  Ltd3411??</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">3.2.2 nacos-config</span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">的配置文件</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.008.png" width="554" height="269" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">内容为</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">server:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    port: 8040</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">spring:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    datasource:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        driver-class-name: com.mysql.cj.jdbc.Driver</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        url: jdbc:mysql://mysql-server:3307/coin-exchange?serverTimezone=GMT%2B8</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        username: root</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        password: Ltd3411??</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    redis:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        host: redis-server</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        port: 6380</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        password: Ltd3411??</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    cloud:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        sentinel:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            transport:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">                dashboard: sentinel-server:8858</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        alicloud:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            access-key: LTAI4GEXnLoaQg6UraLEJL1v</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            secret-key: txr1DH29usTcQo5MUSsDGoVBusQQHX</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            oss:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">               endpoint: oss-cn-beijing.aliyuncs.com</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">mybatis-plus:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    configuration:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    mapper-locations: classpath:/mappers/*Mapper.xml</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">jetcache:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    statIntervalMinutes: 15</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    areaInCacheName: false</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    local:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        default:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            type: linkedhashmap</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            keyConvertor: fastjson</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    remote:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">        default:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            type: redis</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            keyConvertor: fastjson</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            valueEncoder: kryo</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            valueDecoder: kryo</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            poolConfig:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">                minIdle: 5</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">                maxIdle: 20</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">                maxTotal: 50</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            host: ${spring.redis.host}</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            port: ${spring.redis.port}</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">            password: ${spring.redis.password}</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">swagger2:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    basePackage: com.bjsxt.controller</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    name: liangtiandong</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    url: www.liangtiandong.com</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    email: liangtiandong@live.com</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    title: </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">推送</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">API</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">接口</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">    </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">description: </span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">推送系统</span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">API</span><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">接口演示</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt; vertical-align:baseline">    </span><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">version: 1.0</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">    termsOfServiceUrl: www.bjsxt.com</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">geetest:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  geetest-id: 3a01ffc01c1d63b37c3dbe8ee9555290</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  geetest-key: 27c7b4a18124d5d649b9c58ca1830871</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">identify:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  url: https://idcert.market.alicloudapi.com/idcard?idCard=%s&amp;name=%s</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  appKey: 203866940</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  appSecret: KF6LRDKejSejx2vfyLqiLP7bVvWOZYCp</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt; vertical-align:baseline">  appCode: 39e89acacec14a9d80782d8aa2893295</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">3.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">添加启动类</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@SpringBootApplication</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@EnableTioWebSocketServer </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">开启</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">tio</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">websocket</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@EnableScheduling</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">ChanServiceApplication </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Autowired</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">TioWebSocketServerBootstrap </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">bootstrap </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public static void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">main</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">[] args) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">SpringApplication</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt; font-style:italic">run</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">ChanServiceApplication</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">.</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">class </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">,args) ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    }</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">3.4 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">添加消息处理的</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">Handler</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:8pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Component</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Slf4j</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">WebSocketMessageHandler </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">implements </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">IWsMsgHandler </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">握手时走这个方法，业务可以在这里获取</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">cookie</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">，</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">request</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">参数等</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">HttpResponse </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">handshake</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">HttpRequest </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">request, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">HttpResponse </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">httpResponse, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">ChannelContext </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">channelContext) </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Exception </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String clientip </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= request.getClientIp();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:8pt; font-style:italic">log</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.info(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:8pt">收到来自</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">{}</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:8pt">的</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">ws</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:8pt">握手包</span><span style="background-color:#ffffff; color:#0037a6; font-family:Consolas; font-size:8pt">\r\n</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">{}"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">clientip</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, request.toString());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">httpResponse;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">握手成功后走的方法</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">httpRequest</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">httpResponse</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">channelContext</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">* @throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt; font-style:italic">Exception</span><br /><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">onAfterHandshaked</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">HttpRequest </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">httpRequest, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">HttpResponse </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">httpResponse, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">ChannelContext </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">channelContext) </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Exception </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">字节消息（</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">binaryType = arraybuffer</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">）过来后会走这个方法</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Object </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">onBytes</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">WsRequest </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">wsRequest, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">byte</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">[] bytes, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">ChannelContext </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">channelContext) </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Exception </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">当客户端发</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">close flag</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">时，会走这个方法</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Object </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">onClose</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">WsRequest </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">wsRequest, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">byte</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">[] bytes, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">ChannelContext </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">channelContext) </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Exception </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">remove</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(channelContext, </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"receive close flag"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">字符消息（</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">binaryType = blob</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">）过来后会走这个方法</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">@Override</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:8pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Object </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:8pt">onText</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">WsRequest </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">wsRequest, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">text, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">ChannelContext </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">channelContext) </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Exception </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">{</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">WsSessionContext wsSessionContext </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= (</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">WsSessionContext</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">) channelContext.get();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">HttpRequest httpRequest </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">wsSessionContext</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getHandshakeRequest();</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">获取</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">websocket</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">握手包</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">/*        if (log.isDebugEnabled()) {</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">            log.debug("</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">握手包</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">:{}", httpRequest);</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">        }*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">        //log.info("</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">收到</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">ws</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">消息</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">:{}", text);</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Objects</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">equals</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"ping"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, text)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"pong"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">      </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">订阅消息</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> ch </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">为订阅的频道</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic"> id </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">为订阅唯一标识</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">JSONObject payload </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">JSONObject</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">parseObject</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(text);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String sub </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">payload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getString(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"sub"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String req </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">payload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getString(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"req"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String cancel </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">payload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getString(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"cancel"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String id </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">payload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getString(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"id"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">如果用户的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">authorization </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String authorization </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">payload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.getString(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"authorization"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">StringUtils</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">hasText</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">authorization</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">JSONObject jsonObject </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">JSON</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">parseObject</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">JwtHelper</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">decode</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">authorization</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">).getClaims());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">String userId </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">= </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">""</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// jsonObject.get() ;</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">bindUser</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(channelContext, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">userId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(!</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Strings</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">isNullOrEmpty</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">sub</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">绑定到群组，后面会有群发</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">bindGroup</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(channelContext, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">sub</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">绑定群</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">返回值是要发送给客户端的内容，一般都是返回</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">null</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">ResponseEntity()</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                    .setId(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">id</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                    .setSubbed(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">sub</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                    .setStatus(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"ok"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                    .build();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">else if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(!</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Strings</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">isNullOrEmpty</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">req</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">else if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(!</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Strings</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">isNullOrEmpty</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">cancel</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:8pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">取消订阅通道</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:8pt; font-style:italic">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">Tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt; font-style:italic">unbindGroup</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">cancel</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">, channelContext);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">ResponseEntity()</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                    .setId(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">id</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                    .setCanceled(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:8pt">cancel</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                    .setStatus(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:8pt">"ok"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">                    .build();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:8pt">return null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:8pt">}</span></p><p style="font-size:6.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:6.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">3.5 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">启动测试</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">打开</span><span style="font-family:Consolas; font-size:10.5pt">: </span><a href="http://www.websocket-test.com/"><span style="color:#0000ff; font-family:Consolas; font-size:10.5pt; text-decoration:underline">http://www.websocket-test.com/</span></a></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.009.png" width="323" height="331" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">3.4 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">推送消息测试</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">3.4.1 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">添加定时任务</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">打开启动类</span><span style="font-family:Consolas; font-size:10.5pt">:ChanServiceApplication:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.010.png" width="502" height="187" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">每</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">5 s </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">给前端主动推送数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Scheduled</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(fixedRate = </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">5000</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">pushData</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(){</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">long </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">time </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">Date().getTime();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">使用</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">o </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">推送数据非常简单</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">sendToGroup</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">bootstrap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getServerTioConfig(),</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"test"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">WsResponse</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">fromText</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">现在是</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">:"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">+</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">time </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"utf-8"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">3.4.2 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">重启观察效果</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.011.png" width="482" height="373" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">4</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">接入</span><span style="font-family:Consolas; font-size:22pt; font-weight:bold">Rocketmq</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">4.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">添加依赖</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;com.alibaba.cloud&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">groupId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    &lt;</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;spring-cloud-stream-binder-rocketmq&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">artifactId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&lt;/</span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">dependency</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">&gt;</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">4.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">添加配置文件</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">spring</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">application</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">name</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: chan-service</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">cloud</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># nacos</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">地址</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">nacos</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">server-addr</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: nacos-server:8848</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">config</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">file-extension</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: yaml</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt"> </span><span style="background-color:#ffffff; color:#ff0000; font-family:Consolas; font-size:9pt; font-weight:bold">   stream:</span><br /><span style="background-color:#ffffff; color:#ff0000; font-family:Consolas; font-size:9pt; font-weight:bold">      bindings:</span><br /><span style="background-color:#ffffff; color:#ff0000; font-family:Consolas; font-size:9pt; font-weight:bold">        tio_group: {destination: tio_group, content-type: text/plain, group: order-group, consumer.maxAttempts: 1}</span><br /><span style="background-color:#ffffff; color:#ff0000; font-family:Consolas; font-size:9pt; font-weight:bold">      rocketmq:</span><br /><span style="background-color:#ffffff; color:#ff0000; font-family:Consolas; font-size:9pt; font-weight:bold">        binder:</span><br /><span style="background-color:#ffffff; color:#ff0000; font-family:Consolas; font-size:9pt; font-weight:bold">          name-server: rocket-server:9876</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">profiles</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">active</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: dev</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">拉取的配置文件的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">dataID =  chan-service-dev.yaml</span><br /><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># tio</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">的配置文件</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">  </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">websocket</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">server</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">port</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">8987  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">监听的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">websocket</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">端口</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">heartbeat-timeout</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">600000  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">心跳时间</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">cluster</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"># </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">开启集群</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">      </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">enabled</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">true</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">      redis</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">#  </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">集群基于</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">Redis Pus/Sub</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">ip</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: redis-server</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">port</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">: </span><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">6380</span><br /><span style="background-color:#ffffff; color:#1750eb; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">password</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">:  Ltd3411??</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">4.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">添加</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">Sink</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public interface </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">Sink </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Input</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:10pt">"tio_group"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">MessageChannel </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:10pt">messageGroupChannel</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">() ;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">4.4 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">添加监听器</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Component</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Slf4j</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">RocketMessageListener </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Autowired</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TioWebSocketServerBootstrap </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">tioWebSocketServerBootstrap </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@StreamListener</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"tio_group"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">handlerMessage</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">message){</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">log</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.info(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">接收到</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">rocketmq</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">的消息</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">========&gt;{}"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">JSON</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">toJSONString</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(message));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">推送给前端的用户就可以了</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">sendToGroup</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">tioWebSocketServerBootstrap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getServerTioConfig(),</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"test"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">WsResponse</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">fromText</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">从</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">rocketmq</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">里面得到了数据</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">:"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">+message,</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"UTF-8"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">4.5 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">测试数据的流动</span></h2><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.5.1 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">在</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">Rocketmq </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">里面新建主题</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.012.png" width="554" height="126" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.013.png" width="554" height="354" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.5.2 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">在</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">websocket</span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">测试网页建立连接</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.014.png" width="345" height="383" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.5.3 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">在</span><span style="font-family:Consolas; font-size:16pt; font-weight:bold">mq</span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">的队列里面发送消息</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.015.png" width="553" height="28" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.016.png" width="554" height="335" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><h3 style="margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:16pt; font-weight:bold">4.5.4 </span><span style="font-family:微软雅黑; font-size:16pt; font-weight:bold">观察前端</span></h3><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.017.png" width="481" height="384" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h1 style="font-size:22pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; text-indent:0pt; widows:0"><span style="font-family:Consolas; font-size:22pt; font-weight:bold">5</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">、</span><span style="font-family:微软雅黑; font-size:22pt; font-weight:bold">适配前端的订阅请求</span></h1><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">5.1 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">前端的订阅请求数据</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">订阅</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.018.png" width="554" height="297" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">退出订阅</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><img src="9203c876-2a6c-45d1-9250-45b9e8c88cfb.019.png" width="490" height="369" alt="" style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline" /></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">数据模型为</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">        {</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">             "sub": </span><span style="font-family:微软雅黑; font-size:8pt; vertical-align:baseline">订阅的组</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:8pt; vertical-align:baseline">             </span><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">"req": </span><span style="font-family:微软雅黑; font-size:8pt; vertical-align:baseline">请求</span><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">(</span><span style="font-family:微软雅黑; font-size:8pt; vertical-align:baseline">预留的</span><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">)</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">             "cancel": </span><span style="font-family:微软雅黑; font-size:8pt; vertical-align:baseline">取消订阅的组</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:8pt; vertical-align:baseline">             </span><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">"id": </span><span style="font-family:微软雅黑; font-size:8pt; vertical-align:baseline">订阅的唯一标识</span><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">(</span><span style="font-family:微软雅黑; font-size:8pt; vertical-align:baseline">无用</span><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">)</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">             "authorization": </span><span style="font-family:微软雅黑; font-size:8pt; vertical-align:baseline">用户的</span><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">token</span></p><p style="font-size:8pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:8pt; vertical-align:baseline">        }</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">5.2 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">响应给前端的数据</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">{</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">&#xa0;</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">    "id" </span><span style="font-family:微软雅黑; font-size:9pt; vertical-align:baseline">推送的</span><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">id,</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">    "ch": </span><span style="font-family:微软雅黑; font-size:9pt; vertical-align:baseline">推送的</span><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">channel,</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">    "status":</span><span style="font-family:微软雅黑; font-size:9pt; vertical-align:baseline">状态</span><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">,</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">    "subbed": </span><span style="font-family:微软雅黑; font-size:9pt; vertical-align:baseline">订阅的组名 </span><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">,</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">    "canceled": </span><span style="font-family:微软雅黑; font-size:9pt; vertical-align:baseline">取消订阅的组名</span><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">,</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">    "event": </span><span style="font-family:微软雅黑; font-size:9pt; vertical-align:baseline">发送的事件</span><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">,</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">    "ts": </span><span style="font-family:微软雅黑; font-size:9pt; vertical-align:baseline">时间戳</span><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">,</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">    "result": </span><span style="font-family:微软雅黑; font-size:9pt; vertical-align:baseline">响应的结果</span><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">,</span></p><p style="font-size:9pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:9pt; vertical-align:baseline">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:微软雅黑; font-size:10.5pt">将他封装成一个对象</span><span style="font-family:Consolas; font-size:10.5pt">:</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Data</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Accessors</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(chain = </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">true</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@AllArgsConstructor</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@NoArgsConstructor</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ResponseEntity </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">subbed</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">canceled</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">event</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">id</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">ch</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">status</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">getTs</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">DateTime().getMillis();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Long  </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">ts</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Object</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">extend </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">LinkedHashMap&lt;&gt;();</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">WsResponse </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">build</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">() {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">extend</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"id"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getId());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">extend</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"ch"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getCh());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">extend</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"status"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getStatus());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">extend</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"subbed"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getSubbed());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">extend</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"canceled"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getCanceled());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">extend</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"event"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getEvent());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">extend</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"ts"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getTs());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">WsResponse</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">fromText</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">JSONObject</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">toJSONString</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">extend</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">), </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"utf-8"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ResponseEntity </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">put</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">key, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Object </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">value) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">extend</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(key, value);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ResponseEntity </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">putAll</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Map</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&lt;</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Object</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">&gt; m) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">extend</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.putAll(m);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return this</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; text-indent:21pt; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">5.3 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">后台解析请求订阅和取消订阅</span></h2><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">当前端发送文本过来</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">wsRequest</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">text</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @param </span><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic">channelContext</span><br /><span style="background-color:#ffffff; color:#3d3d3d; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">* @return</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic"> * @throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt; font-style:italic">Exception</span><br /><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt; font-style:italic"> </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Override</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Object </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">onText</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">WsRequest </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">wsRequest, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">text, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ChannelContext </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">channelContext) </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">throws </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Exception </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Objects</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">equals</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"ping"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, text)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"pong"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">JSONObject payload </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">JSONObject</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">parseObject</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(text);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String sub </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">payload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getString(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"sub"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String req </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">payload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getString(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"req"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String cancel </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">payload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getString(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"cancel"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String id </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">payload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getString(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"id"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">如果用户已登录，同时绑定用户</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String authorization </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">payload</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getString(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"authorization"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(!</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Strings</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">isNullOrEmpty</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">authorization</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) &amp;&amp; </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">authorization</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.startsWith(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"bearer "</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String accessToken </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">authorization</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.replaceAll(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"bearer "</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">""</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// 2 </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">查询我们的菜单数据</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Jwt jwt </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">JwtHelper</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">decode</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">accessToken</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String jwtJsonStr </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">jwt</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getClaims();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">JSONObject jwtJson </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">JSON</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">parseObject</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">jwtJsonStr</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String userId </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">jwtJson</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getString(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"user_name"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">bindUser</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(channelContext, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">userId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">); </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">绑定用户</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(!</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Strings</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">isNullOrEmpty</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">sub</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">绑定到群组，后面会有群发</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">bindGroup</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(channelContext, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">sub</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">返回值是要发送给客户端的内容，一般都是返回</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">null</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">ResponseEntity()</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                .setId(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">id</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                .setSubbed(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">sub</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                .setStatus(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"ok"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                .build();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">else if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(!</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Strings</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">isNullOrEmpty</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">req</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)) {</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    } </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">else if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(!</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Strings</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">isNullOrEmpty</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">cancel</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">//</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">取消订阅通道</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">unbindGroup</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">cancel</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, channelContext);</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">ResponseEntity()</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                .setId(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">id</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                .setCanceled(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">cancel</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                .setStatus(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"ok"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">                .build();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return null</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">5.4 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">使用对象接收</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">MQ</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">里面的消息</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@Data</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@AllArgsConstructor</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@NoArgsConstructor</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">MessagePayload </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">用户的</span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">id</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     */</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">userId</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">订阅的组名称</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@NonNull</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">channel</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">/**</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">     * </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">消息的内容</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:10pt; font-style:italic">     </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">*/</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:10pt; font-style:italic">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">@NonNull</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:10pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:10pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:10pt">String </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:10pt">body</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:10pt">}</span></p></td></tr></table><h2 style="font-size:16pt; line-height:130%; margin:13pt 0pt; orphans:0; page-break-after:avoid; page-break-inside:avoid; text-align:justify; widows:0"><span style="font-family:Arial; font-size:16pt; font-weight:bold">5.5 </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">修改为</span><span style="font-family:Arial; font-size:16pt; font-weight:bold">MessagePayload </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">监听</span></h2><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt"><tr><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:top; width:415.3pt"><p style="background-color:#ffffff; font-size:9pt; line-height:115%; margin:0pt 0pt 10pt"><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Component</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Slf4j</span><br /><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public class </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">RocketMessageListener </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">{</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@Autowired</span><br /><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">private </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">TioWebSocketServerBootstrap </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">tioWebSocketServerBootstrap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@StreamListener</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"tio_group"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">)</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">public void </span><span style="background-color:#ffffff; color:#00627a; font-family:Consolas; font-size:9pt">handlerMessage</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#0000ff; font-family:Consolas; font-size:9pt; font-weight:bold">MessagePayload message</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt; font-style:italic">log</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.info(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">接收到</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">rocketmq</span><span style="background-color:#ffffff; color:#067d17; font-family:宋体; font-size:9pt">的消息</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">========&gt;{}"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">JSON</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">toJSONString</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(message));</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">ResponseEntity responseEntity </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">new </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">ResponseEntity();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">responseEntity</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.setSubbed(message.getChannel());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">responseEntity</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.put(</span><span style="background-color:#ffffff; color:#067d17; font-family:Consolas; font-size:9pt">"result"</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, message.getBody());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:Consolas; font-size:9pt; font-style:italic">// </span><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">推送给前端的用户就可以了</span><br /><span style="background-color:#ffffff; color:#8c8c8c; font-family:宋体; font-size:9pt; font-style:italic">        </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">if </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">StringUtils</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">hasText</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(message.getUserId())) {</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">sendToUser</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">tioWebSocketServerBootstrap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getServerTioConfig(), message.getUserId(), </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">responseEntity</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.build());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">            </span><span style="background-color:#ffffff; color:#0033b3; font-family:Consolas; font-size:9pt">return</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">;</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; color:#9e880d; font-family:Consolas; font-size:9pt">@NonNull </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">String group </span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">= message.getChannel();</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">        </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">Tio</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt; font-style:italic">sendToGroup</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">(</span><span style="background-color:#ffffff; color:#871094; font-family:Consolas; font-size:9pt">tioWebSocketServerBootstrap</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.getServerTioConfig(), </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">group</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">, </span><span style="background-color:#ffffff; font-family:Consolas; font-size:9pt">responseEntity</span><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">.build());</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">    }</span><br /><span style="background-color:#ffffff; color:#080808; font-family:Consolas; font-size:9pt">}</span></p><p style="font-size:7.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:7.5pt; vertical-align:baseline">&#xa0;</span></p></td></tr></table><p style="font-size:10.5pt; line-height:115%; margin:0pt 0pt 10pt; orphans:0; text-align:justify; widows:0"><span style="font-family:Consolas; font-size:10.5pt">&#xa0;</span></p></div><div class="cnzz" style="display: none;">
	        <script src="https://s23.cnzz.com/z_stat.php?id=1277655852&web_id=1277655852" language="JavaScript"></script>
            </div>
            <div class="docpe" style="position: absolute;color: white;margin-left:-450;">
            <a target="_blank" href="http://www.docpe.com">档铺网——在线文档免费处理</a>
            </div>
            </body></html>